package GuiTests;
import java.util.Scanner;
import java.io.*;
public class ReadFile {
	@SuppressWarnings("null")
	public static void main(String[] args) throws IOException {
		String line , word;
		Scanner fileScan , lineScan = null;
		int countWords = 0, countIs = 0 , count = 1;
		
		fileScan = new Scanner(new File("H:\\eclipse_workspace\\APCS\\src\\GuiTests\\test.txt"));
		
		while(fileScan.hasNext()) {
			line = fileScan.nextLine();
			System.out.println("Line: " + count + line);
			count++;
			
			while(lineScan.hasNext()) {
				countWords ++;
				word = lineScan.next();
				System.out.println(word);
				
				for(int i = 0; i < word.length(); i++) {
					if (word.charAt((i))=='I' || word.charAt(i)=='i' ) {
						countIs++;
					}
				}
				
				
			}
		}
		fileScan.close();
		
		System.out.println("YOU HAVE " + countIs + "OF THE LETTER I IN THIS FILE");
		System.out.println("YOU HAVE " + countWords + "WORDS IN THIS FILE");
	}
}
